package com.zmn.plat.common.dictionary;

/**
 * 渠道客户类型
 *
 * @author xiangjunming
 * @since 2019 /08/20 14:47:16
 */
public enum ChannelCustomerTypeEnum {

    /**
     * values 1.个人客户,2.企业客户,3.渠道客户,4.厂家客户,5.技术测试,6.黑名单
     */
    GR(1, "个人客户"),
    QY(2, "企业客户"),
    QDS(3, "渠道客户"),
    CJ(4, "厂家客户"),
    JSCS(5, "技术测试"),
    ;

    /**
     * 个人客户
     */
    public static final int CONSTS_GR = 1;
    /**
     * 企业客户
     */
    public static final int CONSTS_QY = 2;
    /**
     * 渠道客户
     */
    public static final int CONSTS_QDS = 3;
    /**
     * 厂家客户
     */
    public static final int CONSTS_CJ = 4;
    /**
     * 技术测试
     */
    public static final int CONSTS_JSCS = 5;

    private Integer code;
    private String name;

    ChannelCustomerTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ChannelCustomerTypeEnum of(Integer code) {
        if(code == null){
            return null;
        }
        switch (code) {
            case 1:
                return GR;
            case 2:
                return QY;
            case 3:
                return QDS;
            case 4:
                return CJ;
            case 5:
                return JSCS;
            default:
                return null;
        }
    }

    public static String getName(Integer code) {
        ChannelCustomerTypeEnum of = of(code);
        return of == null ? null : of.getName();
    }
}
